<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/share/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>提现申请管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<%@ include file="/WEB-INF/share/easyuilist.jsp"%>
<style>
.ui-underline .ui-select-text {
	border: 1px solid #ccc !important;
}
</style>
<script type="text/javascript">
    	var loadDataUrl = '${ctx}/withdrawcash/GetData';
    	var deleteUrl = '${ctx}/withdrawcash/delete';
    	var detailUrl = '/withdrawcash/detail';
	    $(function () {
	        InitialPage();
	        GetGrid();
	        
	        $("#status").ComboBox({
	            description: "==请选择==",
	            isuse:true
	        })
	    });
	    //初始化页面
	    function InitialPage() {
	        //resize重设(表格、树形)宽高
	        $(window).resize(function (e) {
	            window.setTimeout(function () {
	                $('#gridTable').setGridWidth(($('.gridPanel').width()));
	                $("#gridTable").setGridHeight($(window).height() - 136.5);
	            }, 200);
	            e.stopPropagation();
	        });
	    }
	    //加载表格
	    function GetGrid() {
	        var selectedRowIndex = 0;
	        var $gridTable = $('#gridTable');
	        $gridTable.jqGrid({
	            url: loadDataUrl,
	            datatype: "json",
	            height: $(window).height() - 136.5,
	            autowidth: true,
	            postData : {},
	            colModel: [
	                { label: '主键', name: 'id', hidden: true },
	                { label: '昵称', name: 'uname', width: 80, align: 'left' },
	                { label: "提现金额", name: "money", width: 80, align: "center",
	                	formatter:function(cellvalue,options,rowObject){
	                		return cellvalue+'元';
	                	}
	                },
	                { label: '类型', name: 'withtype', width: 60, align: 'center',
	                	formatter:function(cellvalue,options,rowObject){
	                		if(cellvalue=='1')return '支付宝';
	                		else if(cellvalue=='2')return '微信';
	                	}
	                },
	                { label: '账号', name: 'account', width: 100, align: 'center',
	                	formatter: function (cellvalue, options, rowObject) {
	                		return cellvalue;
	                	}
	                },
	                { label: '验证名称', name: 'name', width: 100, align: 'center'
	                },
	                { label: '电话', name: 'tel', width: 100, align: 'center'
	                },
	                { label: '申请日期', name: 'addtime', width: 140, align: 'center'
	                },
	                { label: '状态', name: 'status', width: 80, align: 'center',
	                	formatter:function(cellvalue,options,rowObject){
	                		if(cellvalue=='1')return '新申请';
	                		else if(cellvalue=='2') return '已返款';
	                		else return '不通过';
	                	}
	                },
	                { label: '返款日期', name: 'returntime', width: 140, align: 'center'
	                },
	                { label: '备注', name: 'remark', width: 300, align: 'center'
	                },
	                { label: "", name: "", width: 10, align: "left" }
	            ],
	            viewrecords: true,
	            rowNum: 20,
	            rowList: [20,30, 50, 100],
	            pager: "#gridPager",
	            rownumbers: true,
	            shrinkToFit: false,
	            gridview: true,
	            onSelectRow: function () {
	                selectedRowIndex = $("#" + this.id).getGridParam('selrow');
	                var status = $("#gridTable").jqGridRowValue("status");
	                if(status=='新申请'){
	                	$('#lr-replace2').removeAttr('disabled');
	                	$('#lr-replace3').removeAttr('disabled');
	                }
	                else{
	                	$('#lr-replace2').attr('disabled','disabled');
	                	$('#lr-replace3').attr('disabled','disabled');
	                }
	            },
	            gridComplete: function () {
	            }
	        });
	        //查询事件
	        $("#btn_Search").click(function () {
	            var queryJson = {
	            		status: $("#status").attr('data-value'),
	            		starttime: $("#starttime").val(),
	            		endtime:$('#endtime').val()
	            }
	            $gridTable.jqGrid('setGridParam', {
	                postData: queryJson, page: 1
	            }).trigger('reloadGrid');
	        });
	    }
	    //编辑
	    function btn_edit() {
	        var keyValue = $("#gridTable").jqGridRowValue("id");
	        if (checkedRow(keyValue)) {
	            dialogOpen({
	                id: "Form",
	                title: '确认返款',
	                url: detailUrl+'?status=2&id=' + keyValue,
		            width: "300px",
		            height: "180px",
	                callBack: function (iframeId) {
	                    top.frames[iframeId].AcceptClick();
	                }
	            });
	        }
	    }
	    //删除
	    function btn_del() {
	        var keyValue = $("#gridTable").jqGridRowValue("id");
	        if (checkedRow(keyValue)) {
	            dialogOpen({
	                id: "Form",
	                title: '确认不通过',
	                url: detailUrl+'?status=3&id=' + keyValue,
		            width: "300px",
		            height: "180px",
	                callBack: function (iframeId) {
	                    top.frames[iframeId].AcceptClick();
	                }
	            });
	        }
	    }
	    
	</script>
</head>
<body class="mybody">
	<div class="titlePanel">
		<div class="title-search">
			<table>
				<tr>
					<td>查询条件</td>
					<td style="padding-left: 10px;">
						<div class="ui-filter" style="width: 200px;">
							<div class="ui-filter-text">点击输入关键字查询</div>
							<div class="ui-filter-list" style="width: 350px;">
								<table class="form" id="filter-form">
									<tr>
										<td class="formTitle">状态：</td>
										<td class="formValue">
                                            <div id="status" style="" type="select" class="ui-select ui-underline" isvalid="yes" checkexpession="NotNull">
						                        <ul>
						                            <li data-value="">===请选择===</li>
						                            <li data-value="1">新申请</li>
						                            <li data-value="2">已返款</li>
						                            <li data-value="3">不通过</li>
						                        </ul>
						                    </div>
										</td>
									</tr>
									<tr>
										<td class="formTitle">申请时间：</td>
										<td class="formValue"><input id="starttime"
											style="display: inline-block; width: 100px;" type="text"
											value="" class="form-control input-wdatepicker"
											onfocus="WdatePicker({maxDate:'%y-%M-%d'})"> 至 <input
											id="endtime" style="display: inline-block; width: 100px;"
											type="text" value="" class="form-control input-wdatepicker"
											onfocus="WdatePicker({maxDate:'%y-%M-%d'})"></td>
									</tr>
								</table>
								<div class="ui-filter-list-bottom">
									<a id="btn_Search" class="btn btn-primary">&nbsp;查&nbsp;&nbsp;询</a>
								</div>
							</div>
						</div>
					</td>
				</tr>
			</table>
		</div>
		<div class="toolbar">
			<div class="btn-group">
				<a id="lr-replace" class="btn btn-default" onclick="reload();"><i
					class="fa fa-refresh"></i>&nbsp;刷新</a>
				<a id="lr-replace2" class="btn btn-default" onclick="btn_edit();"><i
					class="fa fa-cny"></i>&nbsp;确认返款</a>
				<a id="lr-replace3" class="btn btn-default" onclick="btn_del();"><i
					class="fa fa-wordpress"></i>&nbsp;不通过</a>
			</div>
		</div>
	</div>
	<div class="gridPanel">
		<table id="gridTable"></table>
		<div id="gridPager"></div>
	</div>
</body>
</html>
